import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    list: [
      { name: '电视', price: 128 }, { name: '手机', price: 128 }
    ]
  },
  getters: {
    getNum(state) {
      let num = 0
      state.list.forEach(item => num += item.price)
      return num
    }
  },
  mutations: {
  },
  actions: {
  },
  modules: {
  }
})
